#include "Scalar.h"

void set_ply_update_callback( void ( *fnc)());

int read_ply_file( const char *filename_in,
                   int *num_points,
                   int *num_lines,
                   int *num_triangles,
                   int *num_quads,
                   float **lst_points_out, // pointer to a float * to store num_points * 3 coordinates
                   int **lst_lines_out, // pointer to a int * to store num_lines * 2 nodes
                   int **lst_triangles_out, // pointer to a int * to store num_triangles * 3 nodes
                   int **lst_quads_out, // pointer to a int * to store num_quads * 4 nodes
                   float **lst_normals_out, // pointer to a float * to store num_points * 3 normals coordinates
                   float **lst_scalar_out); // pointer to a float * to store num_points * 1 intensity
// these pointers are mallocated inside read_ply_file and should freeed after use. They may be NULL
// returns 1 on success, returns 0 on error

class Scalars;

int write_ply_file( const char *filename,
                    const char *obj_name, 
                    int num_puntos, const Punto *lst_puntos,
                    int num_triangulos, const Triangulo *lst_triangulos,
                     const Scalars **lst_scalars = NULL); // last_scalar[ i] should be NULL

const char *get_ply_error(); // gets error string if there was any error while reading ply file
